<template>
  <div id="app">

    <p>主vue</p>{{msg}}
    <!-- 父传子和子传父  -->
    <Watch title="parent" @myEvent='eventHandler' @myChange='inputChange' />

    <hr>

    <MyComponent />
    <MyComponent title="hello" />
    <MyComponent title="world" />

    <!-- <APIdemo2 /> -->
    <!-- <APIdemo />
    <HelloWorld /> -->
  </div>
</template>

<script>
  import HelloWorld from './components/HelloWorld'
  import APIdemo from './components/APIdemo.vue'
  import APIdemo2 from './components/APIdemo2'

  import MyComponent from './components/MyComponent.vue'
  import Watch from './components/watch'
  export default {
    name: 'App',
    components: {
      HelloWorld,
      APIdemo,
      APIdemo2,
      MyComponent,
      Watch
    },
    data() {
      return {
        msg: ''
      }
    },
    methods: {
      eventHandler(data) {
        console.log('子传父事件被触发', data)
      },
      inputChange(val) {
        this.msg = val
      }
    }
  }
</script>

<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
  }
</style>
